import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级路由
// 导入登录组件
import Login from '@/views/login'

// 导入后台系统布局组件
import Layout from '@/views/layout'

// 导入二级路由
// 默认首页
import Home from '@/views/home'
// 文章管理
import Articles from '@/views/articles'
// 发表文章
import AddArticle from '@/views/addArticle'
// 编辑文章
import EditArticle from '@/views/editArticle'
// 素材管理
import Image from '@/views/image'
// 评论管理
import Comment from '@/views/comment'
// 粉丝管理
import Fans from '@/views/fans'
// 个人设置
import Setting from '@/views/setting'
// 404页面
import NotFound from '@/views/notFound'

Vue.use(VueRouter)

const routes = [
  // 后台系统基础骨架
  {
    path: '/',
    // name: 'Layout',
    component: Layout,
    children: [
      // 默认首页
      {
        path: '/',
        name: 'home',
        component: Home
      },
      // 其他功能页面
      {
        path: '/articles',
        name: 'Articles',
        component: Articles
      },
      {
        path: '/addArticle',
        name: 'AddArticle',
        component: AddArticle
      },
      {
        path: '/editArticle',
        name: 'EditArticle',
        component: EditArticle
      },
      {
        path: '/image',
        name: 'Image',
        component: Image
      },
      {
        path: '/comment',
        name: 'Comment',
        component: Comment
      },
      {
        path: '/fans',
        name: 'Fans',
        component: Fans
      },
      {
        path: '/setting',
        name: 'Setting',
        component: Setting
      }
    ]
  },
  // 登录
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  // 404页面
  {
    path: '*',
    name: 'notFound',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
